#include "navigation.h"


void navigation_task(void *pvParameters)
{
    int msg = 0;
    uint32_t value_len = 0;
    char buffer[512];
    QueueHandle_t handle = xQueueCreate(15, sizeof(MESSAGE_T));
    message_queue_map(MSG_ID_WHEEL_STATE, handle);
    message_queue_map(MSG_ID_RED_LED_CONTROL, handle);
    message_queue_map(MSG_ID_USART1_DMA_RECEIVE, handle);
    
    while (1) 
    {
        if (-1 != MessageRecv(handle, &msg, buffer, &value_len, sizeof(buffer))) 
        {
            switch (msg)
            {
                case MSG_ID_RED_LED_CONTROL:
                    LED1 = *(int *)buffer;                
                    break;

                case MSG_ID_WHEEL_STATE:
                    //pUart4Msg = ()(*(uint32_t*)buffer);
                    UART4_Send_Bytes(g_stUart4Msg.buf, g_stUart4Msg.len);
                    break;
                case MSG_ID_USART1_DMA_RECEIVE:
                    LOGD("receive msg len:%d is : %s", g_stUart1Msg.len, g_stUart1Msg.buf);
                    break;
                    
                default:
                    break;
            }
        }
    }    
}   


